/***************************************************************************
创建者：华磊
 开始时间：         : 2020.11.10
 copyright            : (C) 深圳市华友高科有限公司
 修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 ***************************************************************************
 *   程序文件属性设置视窗
*                                                                         *
 ***************************************************************************/
#include "settingproperty.h"
#include "ui_settingproperty.h"

SettingProperty::SettingProperty(int styleId,QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingProperty)
{
    ui->setupUi(this);

    setGeometry(70,128,460,595);
    initialDisplayStyle(styleId);
    //this->setWindowTitle("settingFileProperty");

    ui->saveSetting_Btn->setText(tr("保存"));
    ui->cancel_Btn->setText(tr("取消"));

    tmpName = "";
    tmpVer = "";
    tmpOwner = "";
    tmpNote = "";

    ui->FileName->setEnabled(false);
}

SettingProperty::~SettingProperty()
{
    delete ui;
}

void SettingProperty::initialDisplayStyle(int styleId)
{
    switch (styleId) {
    case 1:
        this->setGeometry(0,0,600,450);
        ui->widget->setGeometry(20,0,550,400);
        ui->saveSetting_Btn->setGeometry(100,350,70,40);
        ui->cancel_Btn->setGeometry(280,350,70,40);
        break;
    default:
        break;
    }
}

void SettingProperty::clearLineView()
{
    ui->FileName->setText("");
    ui->Version->setText("");
    ui->Owner->setText("");
    ui->Note->setText("");
}

void SettingProperty::showFileInfo()
{
    ui->FileName->setText(tmpName);
    ui->Version->setText(tmpVer);
    ui->Owner->setText(tmpOwner);
    ui->Note->setText(tmpNote);
}

void SettingProperty::getFileInfo()
{
    tmpName =ui->FileName->text();
    tmpVer =ui->Version->text();
    tmpOwner =ui->Owner->text();
    tmpNote =ui->Note->toPlainText();
}

void SettingProperty::changeLanguage()
{
    ui->retranslateUi(this);
}

void SettingProperty::on_saveSetting_Btn_clicked()
{
    emit saveSettingProperty();
    this->close();
}

void SettingProperty::on_cancel_Btn_clicked()
{
    emit cancelSettingProperty();
    this->close();
}
